package com.headwind.logistics.common.error;

import com.headwind.logistics.common.util.ResultCode;
import com.headwind.logistics.common.util.ResultGenerator;

/**
 * @Author 小恶魔
 * @Date 2020-07-16 19:47
 * @Version 1.0
 * @DESCRIPTION 自定义异常类
 */
public class ControllerException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    protected ResultCode errorCode;
    /**
     * 错误信息
     */
    protected String errorMsg;

    public ControllerException() {
        super();
    }

    public ControllerException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

    public ControllerException(ResultCode errorCode, String errorMsg) {

        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public ControllerException(ResultCode errorCode, String errorMsg, Throwable cause) {

        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }


    public ResultCode getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(ResultCode errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getMessage() {
        return errorMsg;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

}
